package com.aerfafish.spider.neo4j.repository;

import com.aerfafish.spider.neo4j.dao.PersonManaged;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;

/**
 * @author aerfafish
 * @date 2021/4/23 11:16 上午
 */
public interface PersonManagedRepository extends Neo4jRepository<PersonManaged, Long> {

    @Query("merge (company:Company{code: $companyCode}) " +
            "merge (person:Person{code: $personCode})" +
            " merge p = (person)-[r:PERSON_MANAGED_FUND]->(company)")
    void save(@Param("personCode") String personCode, @Param("companyCode") String companyCode);
}
